#include "key.h"
static void GPIO_config()
{
    P5_MODE_IO_PU(GPIO_Pin_1) // 按键
}



void key_init()
{
    GPIO_config();
	Motor_Init();
	Buzzer_init();
}
#define KEY P51

void key()
{
    static u8 key_state = 1;
    while(1){
    if (KEY != key_state)
    {
        if (KEY)
        {
            Motor_Run(KEY);
			 Buzzer_stop();
             
        }
        else if(KEY ==0 )
        {
            Motor_Run(KEY);
            Buzzer_play();
        }  
        key_state = KEY;
		
		os_wait2(K_TMO,10);
    }
  }
}
